﻿<%@ page contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<head>
<title>平台优惠劵列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%=request.getContextPath()%>/style/adminStyle.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script src="<%=request.getContextPath()%>/js/jquery.min.js"></script>

</head>
<body>
 <div class="wrap">
  
   <div class="operate">
  		 <form action="../Administrators/coupon_get_getpon.do" name="Form">
				<img src="../images/icon_search.gif" /> 
				  <select class="inline-select"  name="usagestate">
     					<option value="1">已绑定</option>
     					<option value="0">未绑定</option>
     			  </select>
     			 
     			   <select class="inline-select" name="usingplatform">
     					<option value="${detalist[0].usingplatform}">${detalist[0].usingplatform}</option> 					
     			  </select>    			
					<input type="submit" value="查询" class="tdBtn"/>
			</form>
  </div>
  
  <table class="list-style Interlaced">
   <tr>
    <th>id</th>
    <th>发放平台名称</th>
    <th>优惠金额</th>
    <th>优惠码</th>
    <th>绑定账号</th>
    <th>是否绑定</th>
    <th>操作</th>
   </tr>
   <c:forEach items="${detalist}" var="det" >
   <tr>
   	<td align="center">${det.id}</td>
   	<td align="center" id="usingplatform">${det.usingplatform}</td>
   	<td align="center">${det.reduction}</td>
   	<td align="center">${det.serialnumber}</td>
   	<td align="center">${det.accountnumber}</td>
   	<c:if test="${det.usagestate==0}">
    <td align="center" title="未绑定"><img src="../images/no.gif"/></td>
  </c:if>
  
   	<c:if test="${det.usagestate==1}">
    <td align="center" title="已绑定"><img src="../images/yes.gif"/></td>
  </c:if>
    <td class="center">
     <a class="inline-block" title="删除" onclick="delets(${det.id},&quot+${det.usingplatform}+&quot)"><img src="../images/icon_drop.gif"/></a>
    </td>
   </tr>
   </c:forEach>
  </table>
  <!-- BatchOperation -->
  <div style="overflow:hidden;">
     
	 
  </div>
 </div>
<script type="text/javascript">

delets=function(id,usingplatform) {
		var msg = "您确定要删除吗？\n\n请确认！";
		var sr=${admin.jurisdiction};

		var str=usingplatform.replace("+","").replace("+","");
		
		if (confirm(msg)==true){
			if(sr==1){
				  alert("权限不足");
			}else{
				$.ajax({
					"url":"${pageContext.request.contextPath}/Administrators/coupon_delete.do",
					"data":"id="+id,
					"type":"POST",
					"dataType":"json",
					"success":function(obj){
						if(obj.state==1){
							 alert("删除成功");
							 window.location="${pageContext.request.contextPath}/Administrators/coupon_detailed.do?usingplatform="+str							
						}else{
							 alert("删除失败");
						}
				
					}});
			}
		}
		}
 
 
 </script>
</body>
</html>